package com.qzdsoft.erpcloud.controller.sys;

import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.qzdsoft.erpcloud.service.sys.SysLogService;
import com.qzdsoft.erpcloud.vo.sys.SysLogInfo;
import com.qzdsoft.erpcloud.vo.sys.SysLogQueryParam;
import com.qzdsoft.vo.LayTableResponse;

@Controller
@RequestMapping("/sys/log")
public class SysLogController
{
    private static final Logger logger = org.slf4j.LoggerFactory.getLogger(SysLogController.class);
    
    private static final String BASEPATH = "/sys/log";
    
    @Autowired
    SysLogService sysLogService;
    
    @RequestMapping("/index")
    public ModelAndView index() {
        ModelAndView mv = new ModelAndView();
        mv.setViewName("sys/syslog/index");
        return mv;
    }
    
    @ResponseBody
    @RequestMapping("/data")
    public LayTableResponse<SysLogInfo> list(SysLogQueryParam info)
    {
        logger.debug("查询系统日志，参数：{}",info);
        //如果初始化查询返回无数据空页
        if(info.isFirst()) {
            return LayTableResponse.nullDataPage();
        }else {
            return sysLogService.getList(info);
        }
    }

}
